/**
 * @description 问卷标题组件
 * @author 大肘子
 */

import React, { FC } from 'react'
import style from './index.module.scss'

type QuestionParagraphType = {
  fe_id: string
  props: {
    title: string
    iscenter: boolean
  }
}

const QuestionParagraph: FC<QuestionParagraphType> = ({ fe_id, props }) => {
  const { title, iscenter } = props    
  const textlist = title.split('\n')
  return (
    <>
      <p className={style.title} style={{ textAlign: iscenter ? 'center' : 'start'}}>
        {textlist.map((item,index)=>{
          return <span key={index}>
            {index > 0 && <br/>}
            {item}
          </span>
        })}
      </p>
    </>
  )
}

export default QuestionParagraph
